package org.tinygroup.stopword.impl;

import java.util.HashSet;
import java.util.List;
import java.util.Set;

import org.tinygroup.stopword.StopWordManager;

/**
 * 默认的停止词管理器
 * 
 * @author yancheng11334
 * 
 */
public class DefaultStopWordManager implements StopWordManager {

	private Set<String> stopWordSet = new HashSet<String>();

	public void addStopWord(String stopWord) {
		stopWordSet.add(stopWord);
	}

	public void addStopWords(List<String> stopWords) {
		if (stopWords != null) {
			for (String stopWord : stopWords) {
				addStopWord(stopWord);
			}
		}
	}

	public void removeStopWord(String stopWord) {
		stopWordSet.remove(stopWord);
	}

	public void removeStopWords(List<String> stopWords) {
		if (stopWords != null) {
			for (String stopWord : stopWords) {
				removeStopWord(stopWord);
			}
		}
	}

	public void cleanStopWords() {
		stopWordSet.clear();
	}

	public Set<String> getStopWords() {
		return stopWordSet;
	}

}
